/**
 * Created by Administrator on 2017/4/9.
 */

var mongo = require('../../config').mongo;

var mongoose = require('mongoose');

mongoose.connect(mongo.developmentDB, mongo.options, function (err, result) {

    if (err) {

        console.log('[mongoose log] Error connecting to: ' + mongo.developmentDB + '.' + err);

    } else {

        console.log('[mongoose log] Successfully connected to: ' + mongo.developmentDB);

    }

});

mongoose.connection.on('error',
    console.error.bind
    (
        console,
        'mongoose connection error:'
    )
);
//预留打日志
mongoose.connection.once('open', function () {

    console.log('[mongoose log] mongoose open success');

});

exports.mongoose = mongoose;